﻿using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.JDPostBoard.Entity
{
    [Table("MeetingRoomApply", "ID", "JDPB.ConnectionString")]
    public class MeetingRoomApply : Info
    {
        #region SQL column name consts
        public const string SQLCOL_ID = "ID";
        public const string SQLCOL_ROOMID = "RoomID";
        public const string SQLCOL_TOPIC = "Topic";
        public const string SQLCOL_TYPE = "Type";
        public const string SQLCOL_PEOPLECOUNT = "PeopleCount";
        public const string SQLCOL_MEETINGDATE = "MeetingDate";
        public const string SQLCOL_CONVERTTIME = "ConvertTime";
        public const string SQLCOL_STARTDATETIME = "StartDateTime";
        public const string SQLCOL_STARTTIME = "StartTime";
        public const string SQLCOL_ENDTIME = "EndTime";
        public const string SQLCOL_APPLICANT = "Applicant";
        public const string SQLCOL_APPLICANTNAME = "ApplicantName";
        public const string SQLCOL_GROUPID = "GroupID";
        public const string SQLCOL_GROUPNAME = "GroupName";
        public const string SQLCOL_APPLYDATE = "ApplyDate";
        public const string SQLCOL_STATUS = "Status";
        public const string SQLCOL_NOTES = "Notes";
        public const string SQLCOL_AUDITUSERID = "AuditUserID";
        public const string SQLCOL_AUDITUSERNAME = "AuditUserName";
        public const string SQLCOL_AUDITTIME = "AuditTime";
        public const string SQLCOL_ORIGINID = "OriginID";
        public const string SQLCOL_REMARK1 = "Remark1";
        public const string SQLCOL_REMARK2 = "Remark2";
        public const string SQLCOL_REMARK3 = "Remark3";
        public const string SQLCOL_DURATION = "Duration";
        public const string SQLCOL_VISITANTNATIONALITY = "VisitantNationality";
        public const string SQLCOL_REMARK4 = "Remark4";
        public const string SQLCOL_HB = "Hb";
        public const string SQLCOL_HYC = "Hyc";
        public const string SQLCOL_XK = "Xk";
        public const string SQLCOL_HYFW = "Hyfw";
        public const string SQLCOL_SHYJ = "Shyj";
        public const string SQLCOL_SBBM = "Sbbm";
        public const string SQLCOL_PHONE = "Phone";
        public const string SQLCOL_ZSP = "Zsp";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public MeetingRoomApply() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public MeetingRoomApply(int ID)
        {
            this.ID = ID;
        }
        #endregion

        public override void Init(DataRow row)
        {
            ID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_ID]);
            RoomID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_ROOMID]);
            Topic = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_TOPIC]);
            Type = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_TYPE]);
            PeopleCount = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_PEOPLECOUNT]);
            MeetingDate = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_MEETINGDATE]);
            ConvertTime = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_CONVERTTIME]);
            StartDateTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_STARTDATETIME]);
            StartTime = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_STARTTIME]);
            EndTime = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_ENDTIME]);
            Applicant = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_APPLICANT]);
            ApplicantName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_APPLICANTNAME]);
            GroupID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_GROUPID]);
            GroupName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_GROUPNAME]);
            ApplyDate = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_APPLYDATE]);
            Status = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_STATUS]);
            Notes = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_NOTES]);
            AuditUserID = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_AUDITUSERID]);
            AuditUserName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_AUDITUSERNAME]);
            AuditTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_AUDITTIME]);
            OriginID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_ORIGINID]);
            Remark1 = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_REMARK1]);
            Remark2 = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_REMARK2]);
            Remark3 = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_REMARK3]);
            Duration = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_DURATION]);
            VisitantNationality = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_VISITANTNATIONALITY]);
            Remark4 = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_REMARK4]);
            Hb = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_HB]);
            Hyc = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_HYC]);
            Xk = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_XK]);
            Hyfw = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_HYFW]);
            Shyj = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SHYJ]);
            Sbbm = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_SBBM]);
            Phone = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_PHONE]);
            Zsp = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_ZSP]);
        }

        #region Properties
        #region Property <int> ID
        [Property("ID", 4, SqlDbType.Int, true, true)]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        private int _ID = int.MinValue;
        #endregion

        #region Property <int> RoomID
        [Property("RoomID", 4, SqlDbType.Int, false, false)]
        public int RoomID
        {
            get { return _RoomID; }
            set { _RoomID = value; }
        }
        private int _RoomID = int.MinValue;
        #endregion

        #region Property <string> Topic
        [Property("Topic", 400, SqlDbType.NVarChar, false, false)]
        public string Topic
        {
            get { return _Topic; }
            set { _Topic = value; }
        }
        private string _Topic = null;
        #endregion

        #region Property <int> Type
        [Property("Type", 4, SqlDbType.Int, false, false)]
        public int Type
        {
            get { return _Type; }
            set { _Type = value; }
        }
        private int _Type = int.MinValue;
        #endregion

        #region Property <int> PeopleCount
        [Property("PeopleCount", 4, SqlDbType.Int, false, false)]
        public int PeopleCount
        {
            get { return _PeopleCount; }
            set { _PeopleCount = value; }
        }
        private int _PeopleCount = int.MinValue;
        #endregion

        #region Property <DateTime> MeetingDate
        [Property("MeetingDate", 16, SqlDbType.DateTime, false, false)]
        public DateTime MeetingDate
        {
            get { return _MeetingDate; }
            set { _MeetingDate = value; }
        }
        private DateTime _MeetingDate = DateTime.MinValue;
        #endregion

        #region Property <int> ConvertTime
        [Property("ConvertTime", 4, SqlDbType.Int, false, false)]
        public int ConvertTime
        {
            get { return _ConvertTime; }
            set { _ConvertTime = value; }
        }
        private int _ConvertTime = int.MinValue;
        #endregion

        #region Property <DateTime> StartDateTime
        [Property("StartDateTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime StartDateTime
        {
            get { return _StartDateTime; }
            set { _StartDateTime = value; }
        }
        private DateTime _StartDateTime = DateTime.MinValue;
        #endregion

        #region Property <string> StartTime
        [Property("StartTime", 20, SqlDbType.NVarChar, false, false)]
        public string StartTime
        {
            get { return _StartTime; }
            set { _StartTime = value; }
        }
        private string _StartTime = null;
        #endregion

        #region Property <string> EndTime
        [Property("EndTime", 20, SqlDbType.NVarChar, false, false)]
        public string EndTime
        {
            get { return _EndTime; }
            set { _EndTime = value; }
        }
        private string _EndTime = null;
        #endregion

        #region Property <string> Applicant
        [Property("Applicant", 40, SqlDbType.NVarChar, false, false)]
        public string Applicant
        {
            get { return _Applicant; }
            set { _Applicant = value; }
        }
        private string _Applicant = null;
        #endregion

        #region Property <string> ApplicantName
        [Property("ApplicantName", 100, SqlDbType.NVarChar, false, false)]
        public string ApplicantName
        {
            get { return _ApplicantName; }
            set { _ApplicantName = value; }
        }
        private string _ApplicantName = null;
        #endregion

        #region Property <Guid> GroupID
        [Property("GroupID", 16, SqlDbType.UniqueIdentifier, false, false)]
        public Guid GroupID
        {
            get { return _GroupID; }
            set { _GroupID = value; }
        }
        private Guid _GroupID = Guid.Empty;
        #endregion

        #region Property <string> GroupName
        [Property("GroupName", 100, SqlDbType.NVarChar, false, false)]
        public string GroupName
        {
            get { return _GroupName; }
            set { _GroupName = value; }
        }
        private string _GroupName = null;
        #endregion

        #region Property <DateTime> ApplyDate
        [Property("ApplyDate", 16, SqlDbType.DateTime, false, false)]
        public DateTime ApplyDate
        {
            get { return _ApplyDate; }
            set { _ApplyDate = value; }
        }
        private DateTime _ApplyDate = DateTime.MinValue;
        #endregion

        #region Property <string> Status
        [Property("Status", 1, SqlDbType.Char, false, false)]
        public string Status
        {
            get { return _Status; }
            set { _Status = value; }
        }
        private string _Status = null;
        #endregion

        #region Property <string> Notes
        [Property("Notes", 1000, SqlDbType.NVarChar, false, false)]
        public string Notes
        {
            get { return _Notes; }
            set { _Notes = value; }
        }
        private string _Notes = null;
        #endregion

        #region Property <string> AuditUserID
        [Property("AuditUserID", 40, SqlDbType.NVarChar, false, false)]
        public string AuditUserID
        {
            get { return _AuditUserID; }
            set { _AuditUserID = value; }
        }
        private string _AuditUserID = null;
        #endregion

        #region Property <string> AuditUserName
        [Property("AuditUserName", 100, SqlDbType.NVarChar, false, false)]
        public string AuditUserName
        {
            get { return _AuditUserName; }
            set { _AuditUserName = value; }
        }
        private string _AuditUserName = null;
        #endregion

        #region Property <DateTime> AuditTime
        [Property("AuditTime", 16, SqlDbType.DateTime, false, false)]
        public DateTime AuditTime
        {
            get { return _AuditTime; }
            set { _AuditTime = value; }
        }
        private DateTime _AuditTime = DateTime.MinValue;
        #endregion

        #region Property <int> OriginID
        [Property("OriginID", 4, SqlDbType.Int, false, false)]
        public int OriginID
        {
            get { return _OriginID; }
            set { _OriginID = value; }
        }
        private int _OriginID = int.MinValue;
        #endregion

        #region Property <string> Remark1
        [Property("Remark1", 200, SqlDbType.NVarChar, false, false)]
        public string Remark1
        {
            get { return _Remark1; }
            set { _Remark1 = value; }
        }
        private string _Remark1 = null;
        #endregion

        #region Property <int> Remark2
        [Property("Remark2", 4, SqlDbType.Int, false, false)]
        public int Remark2
        {
            get { return _Remark2; }
            set { _Remark2 = value; }
        }
        private int _Remark2 = int.MinValue;
        #endregion

        #region Property <string> Remark3
        [Property("Remark3", 4000, SqlDbType.NVarChar, false, false)]
        public string Remark3
        {
            get { return _Remark3; }
            set { _Remark3 = value; }
        }
        private string _Remark3 = null;
        #endregion

        #region Property <string> Duration
        [Property("Duration", 20, SqlDbType.NVarChar, false, false)]
        public string Duration
        {
            get { return _Duration; }
            set { _Duration = value; }
        }
        private string _Duration = null;
        #endregion

        #region Property <string> VisitantNationality
        [Property("VisitantNationality", 100, SqlDbType.NVarChar, false, false)]
        public string VisitantNationality
        {
            get { return _VisitantNationality; }
            set { _VisitantNationality = value; }
        }
        private string _VisitantNationality = null;
        #endregion

        #region Property <string> Remark4
        [Property("Remark4", 200, SqlDbType.NVarChar, false, false)]
        public string Remark4
        {
            get { return _Remark4; }
            set { _Remark4 = value; }
        }
        private string _Remark4 = null;
        #endregion

        #region Property <string> Hb
        [Property("Hb", 100, SqlDbType.NVarChar, false, false)]
        public string Hb
        {
            get { return _Hb; }
            set { _Hb = value; }
        }
        private string _Hb = null;
        #endregion

        #region Property <string> Hyc
        [Property("Hyc", 100, SqlDbType.NVarChar, false, false)]
        public string Hyc
        {
            get { return _Hyc; }
            set { _Hyc = value; }
        }
        private string _Hyc = null;
        #endregion

        #region Property <string> Xk
        [Property("Xk", 100, SqlDbType.NVarChar, false, false)]
        public string Xk
        {
            get { return _Xk; }
            set { _Xk = value; }
        }
        private string _Xk = null;
        #endregion

        #region Property <string> Hyfw
        [Property("Hyfw", 100, SqlDbType.NVarChar, false, false)]
        public string Hyfw
        {
            get { return _Hyfw; }
            set { _Hyfw = value; }
        }
        private string _Hyfw = null;
        #endregion

        #region Property <string> Shyj
        [Property("Shyj", 1000, SqlDbType.NVarChar, false, false)]
        public string Shyj
        {
            get { return _Shyj; }
            set { _Shyj = value; }
        }
        private string _Shyj = null;
        #endregion

        #region Property <string> Sbbm
        [Property("Sbbm", 100, SqlDbType.NVarChar, false, false)]
        public string Sbbm
        {
            get { return _Sbbm; }
            set { _Sbbm = value; }
        }
        private string _Sbbm = null;
        #endregion

        #region Property <string> Phone
        [Property("Phone", 100, SqlDbType.NVarChar, false, false)]
        public string Phone
        {
            get { return _Phone; }
            set { _Phone = value; }
        }
        private string _Phone = null;
        #endregion

        #region Property <string> Zsp
        [Property("Zsp", 100, SqlDbType.NVarChar, false, false)]
        public string Zsp
        {
            get { return _Zsp; }
            set { _Zsp = value; }
        }
        private string _Zsp = null;
        #endregion
        #endregion


        public bool LoadByIdentity(int ID)
        {
            return DataAccess.SelectByIdentity(this, Convert.ToInt64(ID));
        }


        public bool DeleteByIdentity()
        {
            return DataAccess.DeleteByIdentity(this);
        }
    }
}
